<%@page language="java" contentType="text/html;charset=utf-8" pageEncoding="UTF-8" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8"/>

    <title>用户管理</title>

    <link href="../../css/mine.css" type="text/css" rel="stylesheet"/>
    <script type="text/javascript" src="/js/jquery-1.8.0.min.js"></script>
    <script type="text/javascript">
        function del() {
            var fo = document.getElementById("fo");
            document.getElementById("mymethod").value="delete";
             fo.submit();

        }
        function daochu() {
            var fo = document.getElementById("fo");
            document.getElementById("mymethod").value="daochu";
            fo.submit();
        }
        $(function () {
            $("#selectall").click(function () {
                if ($(this).prop("checked")==true){
                    $("[name=empid]").prop("checked",true);
                }else{
                    $("[name=empid]").prop("checked",false);
                }
            });

        })
    </script>
</head>
<body>
<style>
    .tr_color {
        background-color: #9F88FF
    }
</style>
<div class="div_head">
            <span>
                <span style="float: left;">当前位置是：系统管理-》用户管理</span>
                <span style="float: right; margin-right: 8px; font-weight: bold;">
                    <span onclick="daochu()" style="color: blue; cursor: pointer">导出数据</span>
                    <a style="text-decoration: none;" href="/Resource/demo2/deptList">【添加】</a>
					<span onclick="del()" style="color: blue; cursor: pointer">删除</span>
                </span>
            </span>
</div>
<div></div>
<div class="div_search">
            <span>
                <form action="/resource/demo2/pageShow" method="post">
                     姓名：
					<input type="text" name="username" value="${username}"/>
					 角色: 
					<input type="text" name="rolename" value="${rolename}"/>
					 所属部门: 
					<input type="text" name="deptname" value="${deptname}"/>
                    <input value="查询" type="submit"/>
					
                </form>
            </span>
</div>
<div style="font-size: 13px; margin: 10px 5px;">
    <form action="/resource/demo2/deletebyid" id="fo" method="post">
        <table class="table_a" border="1" width="100%">
            <tbody>
            <tr style="font-weight: bold;">
                <input type="hidden" id="mymethod" name="method">
                <td width="40px;">序号</td>
                <td width="30px;"><input type="checkbox" id="selectall"/></td>
                <td width="80px;">账号</td>
                <td width="80px;">姓名</td>
                <td>角色</td>
                <td width="100px;">所属部门</td>
                <td align="center" width="100px;">操作</td>
            </tr>
            <c:forEach items="${info.list}" var="emp" varStatus="a">
                <tr>
                    <td>${a.count}</td>
                    <td width="30px;"><input type="checkbox" name="empid" value="${emp.id}" /></td>
                    <td>${emp.employeenum}</td>
                    <td>${emp.username}</td>
                    <td>${emp.role.rname}</td>
                    <td>${emp.dept.deptname}</td>
                    <td>
                        <a href="/resource/demo2/findById?id=${emp.id}">修改</a>
                     <c:if test="${emp.id!=sessionScope.user.id}"><a href="/resource/demo2/deleteById?id=${emp.id}">删除</a></c:if>
                    </td>
                </tr>
            </c:forEach>


            <tr>
                <td colspan="20" style="text-align: center;">
                    <a href="/resource/demo2/pageShow?username=${username}&rolename=${rolename}&deptname=${deptname}">首页</a>
                    <a href="/resource/demo2/pageShow?index=${info.prePage!=0?info.prePage:1}&username=${username}&rolename=${rolename}&deptname=${deptname}">上一页</a>
                    <c:forEach begin="1" end="${info.lastPage}" var="i">
                        <a href="/resource/demo2/pageShow?index=${i}&username=${username}&rolename=${rolename}&deptname=${deptname}">${i}</a>
                    </c:forEach>
                    <a href="/resource/demo2/pageShow?index=${info.nextPage!=0?info.nextPage:info.pages}&username=${username}&rolename=${rolename}&deptname=${deptname}">下一页</a>
                    <a href="/resource/demo2/pageShow?index=${info.lastPage}&username=${username}&rolename=${rolename}&deptname=${deptname}">尾页</a>
                    (总共:${info.total}条||${info.pages}页)
                </td>
            </tr>
            </tbody>
        </table>
    </form>
</div>
</body>
</html>